<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>


<script type="text/javascript">
//     让时间滚动
    var num = 0;
    setInterval(function () {
        num++;
        if(num == 1140){
            num=0;
        }
        document.getElementById('txt').style.marginLeft = '-'+num+'px';

    });

    var t = null;
    function startTime()
    {
        var today=new Date();
        var y=today.getFullYear();
        var h=today.getHours();
        var m=today.getMinutes();
        var s=today.getSeconds();

        var weekday=new Array(7);
        weekday[0]="星期日";
        weekday[1]="星期一";
        weekday[2]="星期二";
        weekday[3]="星期三";
        weekday[4]="星期四";
        weekday[5]="星期五";
        weekday[6]="星期六";
// add a zero in front of numbers<10
        m=checkTime(m);
        s=checkTime(s);
        document.getElementById('txt').innerHTML=y+" 年 "+h+":"+m+":"+s+" 今天是" + weekday[today.getDay()];
        t=setTimeout('startTime()',500);
    }

    //如果不足十分钟的就在前面加0，秒数也是一样
    function checkTime(i)
    {

        if (i<10)
        {i="0" + i}
        return i;

    }

//    自定义刷新页面弹出框
// window.open("http://www.lvyestudy.com ","","top=200,left=200");

</script>
<style>
    .center{
        overflow: hidden;
        width: 1400px;
        margin: 0 auto;
    }
</style>
<body onload="startTime()">
<div class="center">
    <div id="txt" style="font-size: 80px;width: 1300px;background-color:pink;"></div>
</div>

</body>
</html>